﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;

namespace GeoAzure.Core.Tests
{
    
    /// <summary>
    ///This is a test class for OverflowAlgorithm and is intended
    ///to contain all OverflowAlgorithm Unit Tests
    ///</summary>
    [TestClass]
    public class SplitAlgorithmFixture
    {
        [TestMethod]
        public void CalculateDistribution()
        {
            //var objectCount = OverflowAlgorithm<IBounded>.MaxObjectsPerNode + 1;
            //IBounded[] testObjects = TestObjectFactory.CreateBoundedObjects(objectCount);

            //var distributionIndex = 1;
            //OverflowAlgorithm<>.Distribution result = new OverflowAlgorithm<IBounded>().CalculateDistribution(distributionIndex, testObjects.Select(item => new IndexEntry<IBounded>(item, item.Bounds, 0)).ToArray());
            //Assert.AreEqual(OverflowAlgorithm.MinObjectsPerNode - 1 + distributionIndex, result.FirstGroup.Length);
            //Assert.AreEqual(objectCount - result.FirstGroup.Length, result.SecondGroup.Length);
            //for (int i = 0; i < result.FirstGroup.Length; i++)
            //{
            //    var bounded = result.FirstGroup[i].Node;
            //    Assert.IsTrue(result.FirstGroupBoundingBox.Contains(bounded.Bounds));
            //}

            //for (int i = 0; i < result.SecondGroup.Length; i++)
            //{
            //    var bounded = result.SecondGroup[i].Node;
            //    Assert.IsTrue(result.SecondGroupBoundingBox.Contains(bounded.Bounds));
            //}
        }
    }
}
